Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

istanbul-lib-coverage

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

istanbul-lib-coverage

Data library for istanbul coverage objects

  • 1.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39M
increased by8.91%
Maintainers
3
Weekly downloads
 
Created

What is istanbul-lib-coverage?

The istanbul-lib-coverage package is a library for JavaScript test coverage measurement and reporting. It provides a set of APIs to instrument code, collect and aggregate coverage data, and generate reports in various formats. It's part of the Istanbul project, which is widely used for tracking code coverage in JavaScript applications.

What are istanbul-lib-coverage's main functionalities?

Creating a Coverage Map

This feature allows you to create a new coverage map. A coverage map is a data structure that holds coverage data for a set of files. This is the first step in collecting and storing coverage information.

const libCoverage = require('istanbul-lib-coverage');
const map = libCoverage.createCoverageMap();

Adding File Coverage

After creating a coverage map, you can add coverage data for individual files. This involves creating a file coverage object for each file and adding it to the coverage map. This is how you populate the coverage map with data.

const fileCoverage = libCoverage.createFileCoverage('path/to/file.js');
map.addFileCoverage(fileCoverage);

Generating Summary Reports

Once you have a populated coverage map, you can generate summary reports. These summaries provide an overview of the coverage data, including statistics like lines covered, statements covered, and so forth. This is useful for getting a quick insight into the coverage of your project.

const summary = map.getCoverageSummary();
console.log(summary.toJSON());

Other packages similar to istanbul-lib-coverage

Keywords

FAQs

Package last updated on 05 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc